{extend name="public:base" /}
{block name="theme"}管理员管理{/block}
{block name="small_theme"}用户组管理{/block}
{block name="breadcrumb"}
<li><a href="{:url('role_group')}">用户组列表</a></li>
<li class="active">新增用户组</li>
{/block}
{block name="content"}
<link rel="stylesheet" href="__CSS__/addcomon.css">
<div class="row" style="padding:15px;">
    <div class="col-xs-12">
        <form id="form">
            <div class="box">
            <div class="box-header" data-original-title="" style="height: 40px;">
                <h2><i class="glyphicon glyphicon-plus"></i>新增用户组</h2>
            </div>
            <div class="add-box"  >
                <div class="box-left" >
                    <div class="form-group">
                        <label>用户组名称:</label>
                        <input type="text" name="title" required class="form-control" value="{$info.title}">
                    </div>
                    <div class="form-group">
                        <label>用户组标识:</label>
                        <input type="text" name="mark" required class="form-control" value="{$info.mark}">
                    </div>
                    <div class="form-group">
                        <label>是否启用:</label>
                        <input name="status" value="1" type="checkbox" checked/> &nbsp;默认启用
                    </div>
                </div>
                <div class="btn-box">
                    {:token()}
                    <button type="button" class="btn btn-color-o" id="submit">确定</button>
                    <button type="reset" class="btn btn-color-g">返回</button>
                </div>

            </div>
        </div>
        </form>
    </div>
</div>
{/block}
{block name="js"}
<script>
    $('#submit').click(function () {
        $.ajax({
            type: "POST",
            url:  "{:url('add_rolerun')}",
            data: $('#form').serialize(),
            beforeSend:function(){
                $(this).attr("disabled","false"); //禁止点击
            },
            success: function(info){
                console.log(info);
                if(info.code==1){
                    layer.msg(info.msg, {icon: 1});
                    setTimeout(function(){
                        location.href=info.url;
                    },3000); //延迟演示
                }else{
                    layer.msg(info.msg, {icon: 5});
                    $('#submit').removeAttr("disabled"); //禁止点击
                }

            }
        });
        return false;
    });
    highlight_subnav("{:url('role_group')}");
</script>'

{/block}